package com.infra.micro.oss.api;

import com.infra.common.resp.PageEx;
import com.infra.common.resp.Response;
import com.infra.micro.oss.fallback.OssFileInfoApiFallback;
import com.infra.micro.oss.model.req.QueryFileInfoReq;
import com.infra.micro.oss.model.vo.FileInfoVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Component
@FeignClient(value = "micro-oss-service", path = "/api/oss", fallbackFactory = OssFileInfoApiFallback.class)
public interface OssFileInfoApi {

    /**
     * 根据系统文件ID查询基础文件信息
     *
     * @param fileId
     * @return
     */
    @GetMapping("/fileInfo/{fileId}")
    Response<FileInfoVO> queryByFileId(@PathVariable("fileId") Long fileId);

    /**
     * 根据系统文件ID列表查询文件信息
     *
     * @param fileIds
     * @return
     */
    @PostMapping("/fileInfos")
    Response<List<FileInfoVO>> queryByFileIds(@RequestBody List<Long> fileIds);

    /**
     * 根据条件查询基础文件列表
     *
     * @param req
     * @return
     */
    @GetMapping(value = "/fileInfo/list")
    Response<PageEx<FileInfoVO, QueryFileInfoReq>> queryByPage(@SpringQueryMap QueryFileInfoReq req);
}
